#define _CRT_SECURE_NO_WARNINGS 1
#include <stdio.h>
int main()
{
	int n, i, x = 0, flag = 0;
	scanf("%d", &n);

	for (i = 1;; i++)
	{
		x = x * 10 + 1;  

		if (x >= n)
		{
			flag = 1;
			printf("%d", x / n);  //记录商数
		}
		else if (flag == 1)  //去除前几位无效的0
			printf("0");

		x = x % n;  //记录余数
        
		if (x == 0)  //能整除就跳出循环
			break;
	}

	printf(" %d", i);
	return 0;
}